<extend name="common" />
<block name="main">
<div class="createpro-main">
    <div class="createpro-bd clear">
        <form id="createproForm" method="post" class="form-horizontal" data-validate="false" action="modifyPwd">
          <div class="form-group">
              <label class="col-lg-2 control-label">原密码</label>
              <div class="col-lg-5">
                  <input type="password" class="form-control" id="old_password" name="old_password" autocomplete="off" value="{$user.username}">
              </div>
          </div>
          <div class="form-group">
            <label class="col-lg-2 control-label">密码</label>
            <div class="col-lg-5">
                <input type="password" class="form-control" id="inputPassword" name="password" placeholder="请输入密码"
                required data-bv-notempty-message="密码必填且不能为空"
                data-bv-identical="true" data-bv-identical-field="confirm_pwd" data-bv-identical-message="两次密码输入不一致"
                data-bv-different="true" data-bv-different-field="old_password" data-bv-different-message="新密码不能和旧密码相同">
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-2 control-label">确认密码</label>
            <div class="col-lg-5">
                <input type="password" class="form-control" id="confirm_pwd" name="confirm_pwd" placeholder="请输入密码"
                required data-bv-notempty-message="密码必填且不能为空"
                data-bv-identical="true" data-bv-identical-field="password" data-bv-identical-message="两次密码输入不一致">
            </div>
        </div>


          <div class="form-group">
              <div class="col-lg-5 col-lg-offset-2">
                  <button type="submit" class="btn btn-primary btn-submit col-lg-12" disabled>保存</button>
              </div>
          </div>
      </form>
  </div>
</div>
<script>
$(function(){
  $('form').bootstrapValidator({
    message: 'This value is not valid',
            feedbackIcons: {/*输入框不同状态，显示图片的样式*/
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {/*验证*/
                old_password: {/*键名username和input name值对应*/
                    message: '无效的密码',
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '旧密码不能为空'
                        },
                        stringLength: {/*长度提示*/
                            min: 6,
                            max: 30,
                            message: '旧密码长度必须在6到30之间'
                        }/*最后一个没有逗号*/
                    }
                },
                password: {
                    message:'密码无效',
                    validators: {
                        notEmpty: {
                            message: '新密码不能为空'
                        },
                        stringLength: {
                            min: 6,
                            max: 30,
                            message: '新密码长度必须在6到30之间'
                        }
                    }
                },
                confirm_pwd: {
                    message:'密码无效',
                    validators: {
                        notEmpty: {
                            message: '新密码不能为空'
                        },
                        stringLength: {
                            min: 6,
                            max: 30,
                            message: '新密码长度必须在6到30之间'
                        }
                    }
                },
            }
  });
})
</script>
</block>